package com.company.tree;

public class DeepOfTree {


    public int getDeepOfTree(TreeNode root) {
        return deepOfTree(root);
    }


    private int deepOfTree(TreeNode root) {
        if (root == null) {
            return 0;
        }

        int leftDeep = deepOfTree(root.left);

        int rightDeep = deepOfTree(root.right);

        return 1+Math.max(leftDeep,rightDeep);
    }
}
